﻿#region Usings

using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;

#endregion

namespace Rail.Net.Core.Model.Nonpersistent.Map
{
    [DataContract]
    public class PolylineModel
    {
        public PolylineModel(int index)
        {
            Index = index;

            options = new PolylineOption { strokeColor = PolylineOption.Colors[Index % 10] };
            path = new List<PolylineData>();
        }

        [DataMember]
        public int Index { get; set; }

        [DataMember]
        public string name { get; set; }

        [DataMember]
        public PolylineOption options { get; set; }

        [DataMember]
        public List<PolylineData> path { get; set; }
    }

    [DataContract]
    public class PolylineOption
    {
        public static List<string> Colors = new List<string>
                                                {
                                                    "Red",
                                                    "Green",
                                                    "Blue",
                                                    "Yellow",
                                                    "Black",
                                                    "Orange",
                                                    "Gray",
                                                    "Pink",
                                                    "Purple",
                                                    "LightGreen"
                                                };

        public PolylineOption()
        {
            strokeColor = Colors[0];
            strokeOpacity = 1.0;
            strokeWeight = 2;
        }

        [DataMember]
        public string strokeColor { get; set; }

        [DataMember]
        public double strokeOpacity { get; set; }

        [DataMember]
        public int strokeWeight { get; set; }
    }

    [DataContract]
    public class PolylineData : IEquatable<PolylineData>
    {
        [DataMember]
        public double lat { get; set; }

        [DataMember]
        public double lng { get; set; }

        #region IEquatable<PolylineData> Members

        public bool Equals(PolylineData other)
        {
            return lat == other.lat && lng == other.lng;
        }

        #endregion
    }
}